<template>
  <div class="header">
    <div class="el-menu">
      <el-menu
        :default-active="activeIndex"
        mode="horizontal"
        :ellipsis="false"
        @select="handleSelect"
      >
        <el-menu-item index="1">任务明细基本信息</el-menu-item>
      </el-menu>
    </div>
  </div>
  <el-descriptions class="margin-top" :column="3" :style="blockMargin">
    <!-- <el-descriptions-item label="物资唯一码"> {{ checkRes.sku }}</el-descriptions-item>
    <el-descriptions-item label="需求物料编码">{{ checkRes.materialCode }}</el-descriptions-item>
    <el-descriptions-item label="物料描述">{{ checkRes.materialCode }}</el-descriptions-item> -->

    <el-descriptions-item label="物资唯一码："> {{ checkRes.sku }} </el-descriptions-item>
    <el-descriptions-item label="需求物料编码：">
      {{ checkRes.materialCode }}
    </el-descriptions-item>
    <el-descriptions-item label="物料描述："> {{ checkRes.materialDesc }} </el-descriptions-item>
    <el-descriptions-item label="物料扩展编码：">
      {{ checkRes.materialExtendCode }}
    </el-descriptions-item>
    <el-descriptions-item label="物料扩展描述：">
      {{ checkRes.materialExtendDesc }}
    </el-descriptions-item>
    <el-descriptions-item label="大类描述："> {{ checkRes.divisionDesc }} </el-descriptions-item>
    <el-descriptions-item label="中类描述："> {{ checkRes.groupDesc }} </el-descriptions-item>
    <el-descriptions-item label="小类描述："> {{ checkRes.classDesc }} </el-descriptions-item>
    <el-descriptions-item label="标准物料：">
      {{ checkRes.standardmaterials }}
    </el-descriptions-item>
    <el-descriptions-item label="需求数量："> {{ checkRes.demandQuantity }} </el-descriptions-item>
    <el-descriptions-item label="单位："> {{ checkRes.unit }} </el-descriptions-item>
    <el-descriptions-item label="概算单价（元）：">
      {{ checkRes.estimatePrice }}
    </el-descriptions-item>
    <el-descriptions-item label="概算总价（元）：">
      {{ checkRes.estimatetotal }}
    </el-descriptions-item>
    <el-descriptions-item label="交货方式："> {{ checkRes.deliveryMethod }} </el-descriptions-item>
    <el-descriptions-item label="交货地点："> {{ checkRes.deliveryAddress }} </el-descriptions-item>
    <el-descriptions-item label="首批交货日期：">
      {{ checkRes.firstdeliveryDate }}
    </el-descriptions-item>
    <el-descriptions-item label="最后一批交货日期：">
      {{ checkRes.lastdeliveryDate }}
    </el-descriptions-item>
    <el-descriptions-item label="电子商务平台技术规范书ID：">
      {{ checkRes.technicalspecificationsId }}
    </el-descriptions-item>
    <el-descriptions-item label="项目编码："> {{ checkRes.projectCode }} </el-descriptions-item>
    <el-descriptions-item label="项目名称："> {{ checkRes.projectName }} </el-descriptions-item>
    <el-descriptions-item label="工程编号："> {{ checkRes.engineeringCode }} </el-descriptions-item>
    <el-descriptions-item label="工程名称："> {{ checkRes.engineeringName }} </el-descriptions-item>
    <el-descriptions-item label="工程电压等级：">
      {{ checkRes.voltageClass }}
    </el-descriptions-item>
    <el-descriptions-item label="编制人中文："> {{ checkRes.preparedby }} </el-descriptions-item>
    <el-descriptions-item label="需求归口管理部门：">
      {{ checkRes.manageDepartment }}
    </el-descriptions-item>
    <el-descriptions-item label="计划编号："> {{ checkRes.planCode }} </el-descriptions-item>
    <el-descriptions-item label="行项目号："> {{ checkRes.projectNumber }} </el-descriptions-item>
    <el-descriptions-item label="前期厂家："> {{ checkRes.previousFactory }} </el-descriptions-item>
    <el-descriptions-item label="设计单位："> {{ checkRes.designUnit }} </el-descriptions-item>
    <el-descriptions-item label="需求计划备注："> {{ checkRes.planRemark }} </el-descriptions-item>
    <el-descriptions-item label="特殊采购方式：">
      {{ checkRes.specialpurchaseMethod }}
    </el-descriptions-item>
    <el-descriptions-item label="配套金具："> {{ checkRes.armourclamp }} </el-descriptions-item>
    <el-descriptions-item label="计划批次："> {{ checkRes.planNumber }} </el-descriptions-item>
    <el-descriptions-item label="计划批次名称：">
      {{ checkRes.planNumberName }}
    </el-descriptions-item>
    <el-descriptions-item label="产权属性："> {{ checkRes.propertyrights }} </el-descriptions-item>
    <el-descriptions-item label="产权属性描述：">
      {{ checkRes.propertyrightsDesc }}
    </el-descriptions-item>
    <el-descriptions-item label="资金属性："> {{ checkRes.propertyfund }} </el-descriptions-item>
    <el-descriptions-item label="资金属性描述：">
      {{ checkRes.propertyfundDesc }}
    </el-descriptions-item>
    <el-descriptions-item label="建设性质：">
      {{ checkRes.ageneralconditons }}
    </el-descriptions-item>
    <el-descriptions-item label="工程性质：">
      {{ checkRes.engineeringproperties }}
    </el-descriptions-item>
    <el-descriptions-item label="项目二级分类：">
      {{ checkRes.projectSecClass }}
    </el-descriptions-item>
    <el-descriptions-item label="项目二级分类描述：">
      {{ checkRes.projetSecClassdesc }}
    </el-descriptions-item>
    <el-descriptions-item label="项目类型描述：">
      {{ checkRes.projectClassdesc }}
    </el-descriptions-item>
    <el-descriptions-item label="项目类别："> {{ checkRes.projectClass }} </el-descriptions-item>
    <el-descriptions-item label="市级属地："> {{ checkRes.city }} </el-descriptions-item>
    <el-descriptions-item label="计划类型："> {{ checkRes.planType }} </el-descriptions-item>
    <el-descriptions-item label="项目列帐单位编码：">
      {{ checkRes.projectUnitCode }}
    </el-descriptions-item>
    <el-descriptions-item label="项目列帐单位描述：">
      {{ checkRes.projectUnitDesc }}
    </el-descriptions-item>
    <el-descriptions-item label="计划提交日期：">
      {{ checkRes.planSubmitDate }}
    </el-descriptions-item>
    <el-descriptions-item label="国网退回时间：">
      {{ checkRes.stategridreturnDate }}
    </el-descriptions-item>
    <el-descriptions-item label="省公司退回时间：">
      {{ checkRes.provincereturnDate }}
    </el-descriptions-item>
    <el-descriptions-item label="市公司退回时间：">
      {{ checkRes.cityreturnDate }}
    </el-descriptions-item>
    <el-descriptions-item label="省公司批准时间：">
      {{ checkRes.provinceapproveDate }}
    </el-descriptions-item>
    <el-descriptions-item label="市公司批准时间：">
      {{ checkRes.cityapproveDate }}
    </el-descriptions-item>
    <el-descriptions-item label="招标模式描述：">
      {{ checkRes.biddingModeDesc }}
    </el-descriptions-item>
    <el-descriptions-item label="计划类型描述：">
      {{ checkRes.planTypeDesc }}
    </el-descriptions-item>
    <el-descriptions-item label="物料组："> {{ checkRes.materialGroup }} </el-descriptions-item>
    <el-descriptions-item label="三级分类："> {{ checkRes.threeClass }} </el-descriptions-item>
    <el-descriptions-item label="三级分类描述：">
      {{ checkRes.threeClassDesc }}
    </el-descriptions-item>
    <el-descriptions-item label="技术规范书编号：">
      {{ checkRes.technicalspecificationsCode }}
    </el-descriptions-item>
    <el-descriptions-item label="项目类型："> {{ checkRes.projectType }} </el-descriptions-item>
    <el-descriptions-item label="计划编制日期：">
      {{ checkRes.planestablishmentDate }}
    </el-descriptions-item>
    <el-descriptions-item label="技术规范书ID验证状态：">
      {{ checkRes.technicalspecificationsStatus }}
    </el-descriptions-item>
    <el-descriptions-item label="审批状态："> {{ checkRes.approveStatus }} </el-descriptions-item>
    <el-descriptions-item label="联系电话："> {{ checkRes.telphone }} </el-descriptions-item>
    <el-descriptions-item label="采购方式差异备注序号：">
      {{ checkRes.remarkSequence }}
    </el-descriptions-item>
    <el-descriptions-item label="采购方式差异备注说明：">
      {{ checkRes.remarkDesc }}
    </el-descriptions-item>
    <el-descriptions-item label="供货周期（计划管理平台）：">
      {{ checkRes.supplyCycle }}
    </el-descriptions-item>
    <el-descriptions-item label="总部批次未使用总部固化ID原因分类：">
      {{ checkRes.remarkClass }}
    </el-descriptions-item>
    <el-descriptions-item label="总部批次未使用总部固化ID详细说明：">
      {{ checkRes.detailRemark }}
    </el-descriptions-item>
    <el-descriptions-item label="批次采购方式：">
      {{ checkRes.procurementMethod }}
    </el-descriptions-item>
    <el-descriptions-item label="目录建议采购方式：">
      {{ checkRes.adviceProcurementMethod }}
    </el-descriptions-item>
    <!-- <el-descriptions-item label="审核结果描述："> {{ checkRes.resultRemark }} </el-descriptions-item>

<el-descriptions-item label="审核状态："> {{ checkRes.status }} </el-descriptions-item>
<el-descriptions-item label="审核结果："> {{ checkRes.result }} </el-descriptions-item> -->
  </el-descriptions>
  <div class="el-menu">
    <el-menu
      :default-active="activeIndex"
      mode="horizontal"
      :ellipsis="false"
      @select="handleSelect"
    >
      <el-menu-item index="1">审核结果明细</el-menu-item>
    </el-menu>
  </div>
  <div style="color: #fc0b0f; padding-bottom: 25px" v-if="checkRes.resultRemark">
    <div style="margin-top: 10px" v-for="(item, index) in arr">{{ index + 1 }}、{{ item }}</div>
    <!-- <div style="margin-top: 10px;">2、概算总价不得大于10亿元</div>
      <div style="margin-top: 10px;">3、气体绝缘封闭式管母线应与同一工程的组合电器配套申报</div> -->
  </div>
  <div style="color: #fc0b0f; padding-bottom: 25px" v-else>审核正常</div>
  <Dialog ref="dialogRef"></Dialog>
</template>

<script lang="ts" setup>
import useTaskStore from '@/store/task/index'
import { useRouter, useRoute } from 'vue-router'
import { ref, watch, reactive, onMounted } from 'vue'
import Search from '@/views/taskDetail/cpns/search.vue'
import Dialog from '@/views/home/cpns/dialog.vue'
const activeIndex = ref('1')
const handleSelect = (key: string, keyPath: string[]) => {
  console.log(key, keyPath)
}
const taskStore = useTaskStore()
// const page = reactive({
//   pagenum: 1,
//   size: 10,
//   total: 40
// })

let tableData = ref([
  // {
  //   id: 'TASK202501202128321',
  //   create_time: '2024-07-23 16:31:35',
  //   update_time: '2024-07-23 16:31:35',
  //   type: '手动上传',
  //   name: ' 20250118.xls'
  // }
])
const dialogRef = ref()
const router = useRouter()
const route = useRoute()

const checkRes = taskStore.taskDetailList.subTaskList.find((item: any) => {
  return item.id === route.query.rowId
})
// console.log('a',a);
const arr = checkRes.resultRemark ? checkRes.resultRemark.split(';').slice(0, -1) : ''

watch(
  () => taskStore.taskDetailList,
  (New, Old) => {
    console.log(New, '888')
    tableData.value = New.subTaskList
    taskStore.page.total = New.total
  },
  { deep: true }
)
//获取仓库列表
const getWarehouse = async () => {
  const res = await taskStore.getTaskDetailList({
    pageNum: taskStore.page.pagenum,
    pageSize: taskStore.page.size,
    mainTaskId: checkRes.mainTaskId
  })
}
getWarehouse()

//删除表格元素
// const handleDelete = async (index: number, row: TableData) => {
//   await taskStore.delWarehouseHandler(row.id)
//   await taskStore.getWarehouseAction()
// }

//修改table元素
const handleEdit = (index: number, row: TableData) => {
  dialogRef.value.dialogVisible = true
  //修改
  dialogRef.value.isNewOrUpdate = false
  dialogRef.value.dialogEditInfoBtn(row)
}

//新增table元素
const addBtn = () => {
  dialogRef.value.isNewOrUpdate = true
  dialogRef.value.dialogVisible = true
}

const jumpToGoods = (row) => {
  // router.push({ name: 'goods',params: { id: row.id } })

  // router.push({ name: 'user', params: { userId: '123' }})

  router.push({ path: '/main/goods', query: { id: row.id, name: row.name } })
}

//size大小切换
const handleSizeChange = () => {
  getWarehouse()
}

//当前页切换
const handleCurrentChange = () => {
  getWarehouse()
  // loginStore.getUserListInfoAction(page.value, size.value)
}
</script>

<style scoped lang="scss">
.el-text {
  cursor: pointer;
}
.el-menu {
  // margin: 20px 0;
  // padding-bottom: 20px;
  margin-bottom: 20px;
  width: 100%;
  .el-menu--horizontal.el-menu {
    border: none;
  }
}
</style>
